(function (w) {
  /*
    设置读取 元素的transforms属性
  */
  w.transformCss = function (node, prop, value) {

    if (node.transformData === undefined) {   // 如果第一次设置属性，给node添加属性
      node.transformData = {};
    }



    if (arguments.length > 2) {
      // 设置属性
      // 把属性的和值添加到 transformData 钟
      node.transformData[prop] = value
      // this.console.log(node.transformData)

      let result = '';
      for (let i in node.transformData) {
        // this.console.log(i)
        switch (i) {
          case 'translate':
          case 'translateX':
          case 'translateY':
          case 'translateZ':
            result += i + "(" + node.transformData[i] + "px) "
            break;
          case 'scale':
          case 'scaleX':
          case 'scaleY':
            result += i + "(" + node.transformData[i] + ") "
            break;
          case 'rotate':
          case 'skew':
          case 'skewX':
          case 'skewY':
            result += i + "(" + node.transformData[i] + "deg) "
            break;
        }
      }
      node.style.transform = result;
    } else {
      // 读取属性
      // 如果取不到值  设置默认值
      // console.log(node.transformData[prop])
      if (node.transformData[prop] === undefined) {
        if (prop === 'scale' || prop === 'scaleX' || prop === 'scaleY') {
          var value = 1;
        } else {
          var value = 0;
        }
      } else {
        var value = node.transformData[prop];
      }
      return value;
    }
  }
})(window)